<template>
	<view class="container">
		<view class="students">
			<image src="/static/images/tx.jpg" mode=""></image>
			<view class="info-title">
				<text class="info-label">编号:</text>
				<text class="info-value">{{ stu.id }}</text>
			</view>
			<view class="info-title">
				<text class="info-label">姓名:</text>
				<text class="info-value">{{ stu.name }}</text>
			</view>

			<view class="info-title">
				<text class="info-label">学院:</text>
				<text class="info-value">{{ stu.department }}</text>
			</view>
			<view class="info-title">
				<text class="info-label">专业:</text>
				<text class="info-value">{{ stu.major }}</text>
			</view>
			<view class="info-title">
				<text class="info-label">电话:</text>
				<text class="info-value">{{ stu.telephone }}</text>
			</view>
			<view class="info-title">
				<text class="info-label">邮箱:</text>
				<text class="info-value">{{ stu.email }}</text>
			</view>
		</view>
		<button class="button" @click="toComment(stu.name)" type="primary" style="width: 90%;">去评论</button>
		<button class="but" @click="seecomment(stu.name)" type="primary" style="width: 90%;">查看评论</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				stu: []
			}
		},
		methods: {
			toComment(name){
							uni.navigateTo({
								url:"../comment/comment?name="+name
							})
						},
			seecomment(name){
				uni.navigateTo({
					url:"../commentlist/commentlist?name="+name
				})
			},
		
			onLoad(option) {
				console.log(option.itemid);
				uni.request({
					url: 'http://localhost:8090/freshmenapp/classmate/findone',
					method: 'POST',
					data: {
						id: option.itemid
					},
					success: res => {
						// console.log(res.data.data);
						this.stu = res.data.data
					},
					fail: () => {
						uni.showToast({
							title: '失败',
							icon: 'none'
						});
					},
					complete: () => {}
				});
			}
		}
	}
</script>

<style>
	image {
		width: 150px;
		height: 150px;
		margin-bottom: 30px;
	}

	.container {
		padding: 20rpx;
		text-align: center;
	}

	.students {
		margin-top: 20rpx;
	}

	.info-title {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 20rpx 0;
		border: 1px solid #ccc;
		border-radius: 10px;
		margin-top: 8px;
	}

	.info-label {
		font-weight: bold;
		width: 100rpx;

	}

	.info-value {
		flex: 1;
	}
	.button{
		margin-top: 20px;
	}
	.but{
		margin-top: 15px;
	}
</style>